<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>捕获</title>
    <script src="../../lib/jquery-3.4.1.js"></script>
</head>
<body>

<p id="p1">这是段落中的<b>粗体</b>文本</p>

<input type="text" value="邢伟新" placeholder="fmy" id="ip1"><br>

<hr>


<button id="btn1">显示文本</button>
<button id="btn2">显示HTML</button>
<button id="btn3">显示input的值</button>

<hr>


<a href="https://www.baidu.com/" id="w3c" target="_blank">点击跳转</a>

<button  id="btn4">显示herf的值</button>


<script>

    $(document).ready(function () {

        $("#btn1").click(function () {

            alert("text:" + $("#p1").text());

        });


        $("#btn2").click(function () {

            alert("html:" + $("#p1").html());

        });


        $("#btn3").click(function () {

            alert("input的值为:" + $("#ip1").val());

        });

        $("#btn4").click(function () {

            alert($("#w3c").attr("href"));
            alert($("#w3c").attr("id"));
        })



    });


</script>



</body>
</html>